<?php
header("Content-type: text/html; charset=utf-8");

include "TopSdk.php";

//签名用的
$app_key = '21118830';
$secret='d6a40ba75088e08857b4c93a67bdc8b5';
$timestamp=time()."000"; 
$message = $secret.'app_key'.$app_key.'timestamp'.$timestamp.$secret; 
$mysign=strtoupper(hash_hmac("md5",$message,$secret)); 
setcookie("timestamp",$timestamp); 
setcookie("sign",$mysign); 

$c = new TopClient;
$c->appkey = $app_key;
$c->secretKey = $secret;
$req = new TaobaokeItemsGetRequest;
$req->setFields("title,pic_url,price,click_url");
$req->setPid(28738608);
$req->setKeyword("floor");
$req->setStartCredit("5heart");
$req->setEndCredit("1crown");
$req->setSort("commissionNum_desc");
$req->setPageNo(1);
$req->setPageSize(2);
$resp = $c->execute($req);

$randNum=rand(0,1);

print_r($resp->taobaoke_items->taobaoke_item[$randNum]->title);


?>
